﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using SoGame.ViewModels;
using System.Windows.Controls.Primitives;

namespace SoGame.Views
{
    /// <summary>
    /// Interaction logic for NewPlayerView.xaml
    /// </summary>
    public partial class NewPlayerView : UserControl
    {
        public NewPlayerView()
        {
            InitializeComponent();
            
            this.KeyDown += new KeyEventHandler(NewPlayerView_KeyDown);
        }

        void NewPlayerView_KeyDown(object sender, KeyEventArgs e)
        {
            NewPlayerViewModel model = this.DataContext as NewPlayerViewModel;
            if (model != null)
            {
                if (e.Key == Key.Up)
                {
                    model.KinectUp();
                    e.Handled = true;
                }
                else if (e.Key == Key.Down)
                {
                    model.KinectDown();
                    e.Handled = true;
                }
            }
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            NewPlayerViewModel model = (sender as Button).DataContext as NewPlayerViewModel;
            model.KinectUp();
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            NewPlayerViewModel model = (sender as Button).DataContext as NewPlayerViewModel;
            model.KinectDown();

        }
    }
}
